<template>
  <div class="" id="Pie3d"></div>
</template>

<script lang="ts" setup>
  import api from '../api'
  import ec from '@/utils/chart'
  const { drawChart } = ec()
  const store = useStore()
  const { proxy } = getCurrentInstance()
  let exposeRef = $ref()
  let data = $ref([])

  // 初始化
  onMounted(async() => {
    await init()
  })

  // 监控
  watch(()=>data, async(val) => {
    await nextTick()
    setChart()
  }, {immediate: false, deep: true})

  // 请求
  const init = async() => {
    data = [
      {value: 189, name: '配发'},
      {value: 735, name: '销毁'},
      {value: 580, name: '借用'},
      {value: 484, name: '维修'},
      {value: 300, name: '其他'}
    ]
  }

  // 绘制
  const setChart = async() => {
    let params1 = {internalDiameterRatio: 0.8, distance: 200, alpha: 30, pieHeight: 20, opacity: 0.8}
    drawChart('Pie3d','Pie3d', '', data, params1)
  }
</script>
  
<style scoped lang="scss">

</style>
  